<html>
<head><meta charset="utf-8"><title>Promotion RFC draft · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html">Promotion RFC draft</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="216790344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/216790344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#216790344">(Nov 15 2020 at 12:41)</a>:</h4>
<p>I have drafted an RFC for the promotion MCP:<br>
<a href="https://github.com/RalfJung/rfcs/blob/infallible-promotion/text/0000-infallible-promotion.md">https://github.com/RalfJung/rfcs/blob/infallible-promotion/text/0000-infallible-promotion.md</a><br>
I'd much appreciate help with filling out the "guide-level" and "reference-level" explanation, as I am somewhat at a loss about what to put there. I don't have the time to exactly transcribe the current promotion algorithm into text, so if that is required I hope someone else can take over at this point.</p>



<a name="217075956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/217075956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#217075956">(Nov 17 2020 at 23:08)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> read the draft</p>



<a name="217075965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/217075965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#217075965">(Nov 17 2020 at 23:08)</a>:</h4>
<p>I think the reference-level can basically just be "no additional details", that's ok</p>



<a name="217076037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/217076037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#217076037">(Nov 17 2020 at 23:09)</a>:</h4>
<p>I have to re-read it a bit more carefully I guess to understand the set of ops that would get promoted and waht the "transition plan" is</p>



<a name="217221770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/217221770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#217221770">(Nov 19 2020 at 02:06)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> the list of fallible operations seems incomplete.. e.g. it mentions accessing union fields, but not dereferencing a pointer</p>



<a name="217221868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/217221868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#217221868">(Nov 19 2020 at 02:08)</a>:</h4>
<p>"or other operations that can introduce UB" would be fine</p>



<a name="217221872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/217221872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#217221872">(Nov 19 2020 at 02:09)</a>:</h4>
<p>it's just a bit confusing because it reads like a complete list</p>



<a name="217221875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/217221875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#217221875">(Nov 19 2020 at 02:09)</a>:</h4>
<p>otherwise, very readable imo</p>



<a name="217299998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/217299998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#217299998">(Nov 19 2020 at 17:06)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116883">tmandry</span> <a href="#narrow/stream/213817-t-lang/topic/Promotion.20RFC.20draft/near/217221872">said</a>:</p>
<blockquote>
<p>it's just a bit confusing because it reads like a complete list</p>
</blockquote>
<p>fair -- I did not mean it to be exhaustive, but generalizing "union field access" to "unsafe operation" is a good idea</p>



<a name="218171737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218171737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218171737">(Nov 28 2020 at 16:55)</a>:</h4>
<p>all right, done that and updated the draft at the link above.</p>



<a name="218171742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218171742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218171742">(Nov 28 2020 at 16:55)</a>:</h4>
<p>If no further comments appear here, I'll officially propose the RFC shortly.</p>



<a name="218172038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218172038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218172038">(Nov 28 2020 at 17:02)</a>:</h4>
<p>The CheckedAdd thing at least confused me a little bit -- I think it's saying that the code would promote to something like this? But as it reads I'm not sure. I guess it's also not super relevant necessarily.</p>
<div class="codehilite"><pre><span></span><code>&amp;(1 + usize::MAX)
</code></pre></div>
<div class="codehilite"><pre><span></span><code>const C: (usize, bool) = (1, true);
assert!(C.1 == false);
&amp;C
</code></pre></div>



<a name="218172120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218172120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218172120">(Nov 28 2020 at 17:04)</a>:</h4>
<p>Yes, that is exactly what happens</p>



<a name="218172124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218172124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218172124">(Nov 28 2020 at 17:04)</a>:</h4>
<p>this is a common source of confusion though -- it took me quite a while to internalize</p>



<a name="218172146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218172146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218172146">(Nov 28 2020 at 17:05)</a>:</h4>
<p>do you think I should expand the comment, maybe add an example? it is not central to the RFC but this seems as good a place as any to explain this.</p>



<a name="218172197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218172197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218172197">(Nov 28 2020 at 17:06)</a>:</h4>
<p>hm</p>



<a name="218172198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218172198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218172198">(Nov 28 2020 at 17:06)</a>:</h4>
<p>I think it wouldn't hurt</p>



<a name="218172223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218172223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218172223">(Nov 28 2020 at 17:07)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> I would also revise the list in the "definitely succeed" paragraph to be two bulleted lists rather than the current sentence structure, it's just hard to parse mentally when reading</p>



<a name="218172299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218172299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218172299">(Nov 28 2020 at 17:09)</a>:</h4>
<p>Otherwise though this looks excellent, thank you for writing it!</p>



<a name="218172447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218172447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218172447">(Nov 28 2020 at 17:12)</a>:</h4>
<p>all right, done both of these</p>



<a name="218172686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218172686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218172686">(Nov 28 2020 at 17:19)</a>:</h4>
<p><span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span> from me. I think having those lists explicit like that is quite helpful</p>



<a name="218172762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218172762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218172762">(Nov 28 2020 at 17:21)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/213817-t-lang/topic/Promotion.20RFC.20draft/near/218172686">said</a>:</p>
<blockquote>
<p><span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span> from me. I think having those lists explicit like that is quite helpful</p>
</blockquote>
<p>definitely, thanks for suggesting that.</p>



<a name="218303551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20RFC%20draft/near/218303551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20RFC.20draft.html#218303551">(Nov 30 2020 at 15:42)</a>:</h4>
<p>All right, the RFC is submitted now: <a href="https://github.com/rust-lang/rfcs/pull/3027">https://github.com/rust-lang/rfcs/pull/3027</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>